package com.server.modules.api.service.impl;

import com.server.common.service.CrudService;
import com.server.modules.api.service.IReturnMsgAPIService;
import com.server.modules.api.vo.BaseQueryVo;
import com.server.modules.sys.dao.errmsg.ErrMsgDao;
import com.server.modules.sys.entity.errmsg.ErrMsg;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Administrator on 2016/8/22.
 */
@Service
public class ReturnMsgAPIServiceImpl extends CrudService<ErrMsgDao, ErrMsg> implements IReturnMsgAPIService {

    @Override
    public BaseQueryVo getRet(int retCode) {
        BaseQueryVo vo = new BaseQueryVo();
        vo.setRetCode(retCode);
        ErrMsg errMsg = new ErrMsg();
        errMsg.setErrCode(""+retCode);
        List<ErrMsg> list = super.findList(errMsg);
        if (list!= null && list.size() > 0){
            ErrMsg retMsg = list.get(0);
            vo.setRetMsg(retMsg.getName());

        }else{
            vo.setRetMsg("未知错误");
        }
        return vo;
    }
}
